<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2024-10-16
  Time: 15:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>编辑用户</title>
    <style>
        .container {
            width: 500px;
            margin: 100px auto;
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        .container h2 {
            text-align: center;
            margin-bottom: 20px;
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-group label {
            display: block;
            margin-bottom: 5px;
        }
        .form-group input[type="text"],
        .form-group input[type="password"] ,
        .form-group select {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        .form-group input[type="submit"] {
            width: 100%;
            padding: 10px;
            border: none;
            border-radius: 4px;
            background-color: #3E93EF;
            color: white;
            cursor: pointer;
        }
        .form-group input[type="submit"]:hover {
            background-color: #4cae4c;
        }
    </style>
</head>
<body>
<div class="container">
    <h2>编辑用户信息</h2>
    <form action="UserServlet?method=update" method="post">
        <div class="form-group">
            <label>用户名:</label>
            <input type="hidden" name="id"  value="${user.id}" required>
            <input type="text" name="username"  value="${user.username}" required>
        </div>
        <div class="form-group">
            <label for="password">密码:</label>
            <input type="password" id="password" name="password" value="${user.password}" required>
        </div>
        <div class="form-group">
            <label>姓名:</label>
            <input type="text" name="name" value="${user.name}">
        </div>
        <div class="form-group">
            <label>性别:</label>
<%--            <select name="gender">--%>
<%--                <option value="0">男</option>--%>
<%--                <option value="1">女</option>--%>
<%--            </select>--%>
            <select name="gender">
                <option value="0" <c:if test="${user.gender eq '0' }">selected</c:if> >男</option>

                <option value="1" <c:if test="${user.gender eq '1' }">selected</c:if> >女</option>
<%--                <c:forEach items="${genderList}" var="gender">--%>
<%--                    <option value="${user.gender}"--%>
<%--                            <c:if test="${gender!=NULL and gender!='' and user.gender eq gender}">--%>
<%--                                selected--%>
<%--                            </c:if>--%>
<%--                    >${user.gender=='0'?'男':'女'}</option>--%>
<%--                </c:forEach>--%>
            </select>
        </div>
        <div class="form-group">
            <label>邮箱:</label>
            <input type="text" name="email" value="${user.email}">
        </div>
        <div class="form-group">
            <label>手机号码:</label>
            <input type="text" name="phonenumber" value="${user.phonenumber}">
        </div>
        <div class="form-group">
            <input type="submit" value="提交">
        </div>
    </form>
</div>
</body>
</html>
